<?php


/**
 * Base class that represents a query for the 'station' table.
 *
 * 
 *
 * @method     StationQuery orderByStationid($order = Criteria::ASC) Order by the stationid column
 * @method     StationQuery orderByStationname($order = Criteria::ASC) Order by the stationname column
 * @method     StationQuery orderByPhonenr($order = Criteria::ASC) Order by the phonenr column
 * @method     StationQuery orderByPostcode($order = Criteria::ASC) Order by the postcode column
 * @method     StationQuery orderByStreet($order = Criteria::ASC) Order by the street column
 *
 * @method     StationQuery groupByStationid() Group by the stationid column
 * @method     StationQuery groupByStationname() Group by the stationname column
 * @method     StationQuery groupByPhonenr() Group by the phonenr column
 * @method     StationQuery groupByPostcode() Group by the postcode column
 * @method     StationQuery groupByStreet() Group by the street column
 *
 * @method     StationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method     StationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method     StationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method     StationQuery leftJoinCity($relationAlias = null) Adds a LEFT JOIN clause to the query using the City relation
 * @method     StationQuery rightJoinCity($relationAlias = null) Adds a RIGHT JOIN clause to the query using the City relation
 * @method     StationQuery innerJoinCity($relationAlias = null) Adds a INNER JOIN clause to the query using the City relation
 *
 * @method     StationQuery leftJoinCar($relationAlias = null) Adds a LEFT JOIN clause to the query using the Car relation
 * @method     StationQuery rightJoinCar($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Car relation
 * @method     StationQuery innerJoinCar($relationAlias = null) Adds a INNER JOIN clause to the query using the Car relation
 *
 * @method     StationQuery leftJoinOffers($relationAlias = null) Adds a LEFT JOIN clause to the query using the Offers relation
 * @method     StationQuery rightJoinOffers($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Offers relation
 * @method     StationQuery innerJoinOffers($relationAlias = null) Adds a INNER JOIN clause to the query using the Offers relation
 *
 * @method     StationQuery leftJoinReservationRelatedByPickup($relationAlias = null) Adds a LEFT JOIN clause to the query using the ReservationRelatedByPickup relation
 * @method     StationQuery rightJoinReservationRelatedByPickup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ReservationRelatedByPickup relation
 * @method     StationQuery innerJoinReservationRelatedByPickup($relationAlias = null) Adds a INNER JOIN clause to the query using the ReservationRelatedByPickup relation
 *
 * @method     StationQuery leftJoinReservationRelatedByDropoff($relationAlias = null) Adds a LEFT JOIN clause to the query using the ReservationRelatedByDropoff relation
 * @method     StationQuery rightJoinReservationRelatedByDropoff($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ReservationRelatedByDropoff relation
 * @method     StationQuery innerJoinReservationRelatedByDropoff($relationAlias = null) Adds a INNER JOIN clause to the query using the ReservationRelatedByDropoff relation
 *
 * @method     StationQuery leftJoinStationhours($relationAlias = null) Adds a LEFT JOIN clause to the query using the Stationhours relation
 * @method     StationQuery rightJoinStationhours($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Stationhours relation
 * @method     StationQuery innerJoinStationhours($relationAlias = null) Adds a INNER JOIN clause to the query using the Stationhours relation
 *
 * @method     Station findOne(PropelPDO $con = null) Return the first Station matching the query
 * @method     Station findOneOrCreate(PropelPDO $con = null) Return the first Station matching the query, or a new Station object populated from the query conditions when no match is found
 *
 * @method     Station findOneByStationid(int $stationid) Return the first Station filtered by the stationid column
 * @method     Station findOneByStationname(string $stationname) Return the first Station filtered by the stationname column
 * @method     Station findOneByPhonenr(string $phonenr) Return the first Station filtered by the phonenr column
 * @method     Station findOneByPostcode(int $postcode) Return the first Station filtered by the postcode column
 * @method     Station findOneByStreet(string $street) Return the first Station filtered by the street column
 *
 * @method     array findByStationid(int $stationid) Return Station objects filtered by the stationid column
 * @method     array findByStationname(string $stationname) Return Station objects filtered by the stationname column
 * @method     array findByPhonenr(string $phonenr) Return Station objects filtered by the phonenr column
 * @method     array findByPostcode(int $postcode) Return Station objects filtered by the postcode column
 * @method     array findByStreet(string $street) Return Station objects filtered by the street column
 *
 * @package    propel.generator.ise-php.om
 */
abstract class BaseStationQuery extends ModelCriteria
{
	
	/**
	 * Initializes internal state of BaseStationQuery object.
	 *
	 * @param     string $dbName The dabase name
	 * @param     string $modelName The phpName of a model, e.g. 'Book'
	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
	 */
	public function __construct($dbName = 'ise-php', $modelName = 'Station', $modelAlias = null)
	{
		parent::__construct($dbName, $modelName, $modelAlias);
	}

	/**
	 * Returns a new StationQuery object.
	 *
	 * @param     string $modelAlias The alias of a model in the query
	 * @param     Criteria $criteria Optional Criteria to build the query from
	 *
	 * @return    StationQuery
	 */
	public static function create($modelAlias = null, $criteria = null)
	{
		if ($criteria instanceof StationQuery) {
			return $criteria;
		}
		$query = new StationQuery();
		if (null !== $modelAlias) {
			$query->setModelAlias($modelAlias);
		}
		if ($criteria instanceof Criteria) {
			$query->mergeWith($criteria);
		}
		return $query;
	}

	/**
	 * Find object by primary key.
	 * Propel uses the instance pool to skip the database if the object exists.
	 * Go fast if the query is untouched.
	 *
	 * <code>
	 * $obj  = $c->findPk(12, $con);
	 * </code>
	 *
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    Station|array|mixed the result, formatted by the current formatter
	 */
	public function findPk($key, $con = null)
	{
		if ($key === null) {
			return null;
		}
		if ((null !== ($obj = StationPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
			// the object is alredy in the instance pool
			return $obj;
		}
		if ($con === null) {
			$con = Propel::getConnection(StationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}
		$this->basePreSelect($con);
		if ($this->formatter || $this->modelAlias || $this->with || $this->select
		 || $this->selectColumns || $this->asColumns || $this->selectModifiers
		 || $this->map || $this->having || $this->joins) {
			return $this->findPkComplex($key, $con);
		} else {
			return $this->findPkSimple($key, $con);
		}
	}

	/**
	 * Find object by primary key using raw SQL to go fast.
	 * Bypass doSelect() and the object formatter by using generated code.
	 *
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con A connection object
	 *
	 * @return    Station A model object, or null if the key is not found
	 */
	protected function findPkSimple($key, $con)
	{
		$sql = 'SELECT `STATIONID`, `STATIONNAME`, `PHONENR`, `POSTCODE`, `STREET` FROM `station` WHERE `STATIONID` = :p0';
		try {
			$stmt = $con->prepare($sql);			
			$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
			$stmt->execute();
		} catch (Exception $e) {
			Propel::log($e->getMessage(), Propel::LOG_ERR);
			throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
		}
		$obj = null;
		if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$obj = new Station();
			$obj->hydrate($row);
			StationPeer::addInstanceToPool($obj, (string) $key);
		}
		$stmt->closeCursor();

		return $obj;
	}

	/**
	 * Find object by primary key.
	 *
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con A connection object
	 *
	 * @return    Station|array|mixed the result, formatted by the current formatter
	 */
	protected function findPkComplex($key, $con)
	{
		// As the query uses a PK condition, no limit(1) is necessary.
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		$stmt = $criteria
			->filterByPrimaryKey($key)
			->doSelect($con);
		return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
	}

	/**
	 * Find objects by primary key
	 * <code>
	 * $objs = $c->findPks(array(12, 56, 832), $con);
	 * </code>
	 * @param     array $keys Primary keys to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
	 */
	public function findPks($keys, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
		}
		$this->basePreSelect($con);
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		$stmt = $criteria
			->filterByPrimaryKeys($keys)
			->doSelect($con);
		return $criteria->getFormatter()->init($criteria)->format($stmt);
	}

	/**
	 * Filter the query by primary key
	 *
	 * @param     mixed $key Primary key to use for the query
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKey($key)
	{
		return $this->addUsingAlias(StationPeer::STATIONID, $key, Criteria::EQUAL);
	}

	/**
	 * Filter the query by a list of primary keys
	 *
	 * @param     array $keys The list of primary key to use for the query
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKeys($keys)
	{
		return $this->addUsingAlias(StationPeer::STATIONID, $keys, Criteria::IN);
	}

	/**
	 * Filter the query on the stationid column
	 *
	 * Example usage:
	 * <code>
	 * $query->filterByStationid(1234); // WHERE stationid = 1234
	 * $query->filterByStationid(array(12, 34)); // WHERE stationid IN (12, 34)
	 * $query->filterByStationid(array('min' => 12)); // WHERE stationid > 12
	 * </code>
	 *
	 * @param     mixed $stationid The value to use as filter.
	 *              Use scalar values for equality.
	 *              Use array values for in_array() equivalent.
	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByStationid($stationid = null, $comparison = null)
	{
		if (is_array($stationid) && null === $comparison) {
			$comparison = Criteria::IN;
		}
		return $this->addUsingAlias(StationPeer::STATIONID, $stationid, $comparison);
	}

	/**
	 * Filter the query on the stationname column
	 *
	 * Example usage:
	 * <code>
	 * $query->filterByStationname('fooValue');   // WHERE stationname = 'fooValue'
	 * $query->filterByStationname('%fooValue%'); // WHERE stationname LIKE '%fooValue%'
	 * </code>
	 *
	 * @param     string $stationname The value to use as filter.
	 *              Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByStationname($stationname = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($stationname)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $stationname)) {
				$stationname = str_replace('*', '%', $stationname);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(StationPeer::STATIONNAME, $stationname, $comparison);
	}

	/**
	 * Filter the query on the phonenr column
	 *
	 * Example usage:
	 * <code>
	 * $query->filterByPhonenr('fooValue');   // WHERE phonenr = 'fooValue'
	 * $query->filterByPhonenr('%fooValue%'); // WHERE phonenr LIKE '%fooValue%'
	 * </code>
	 *
	 * @param     string $phonenr The value to use as filter.
	 *              Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByPhonenr($phonenr = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($phonenr)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $phonenr)) {
				$phonenr = str_replace('*', '%', $phonenr);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(StationPeer::PHONENR, $phonenr, $comparison);
	}

	/**
	 * Filter the query on the postcode column
	 *
	 * Example usage:
	 * <code>
	 * $query->filterByPostcode(1234); // WHERE postcode = 1234
	 * $query->filterByPostcode(array(12, 34)); // WHERE postcode IN (12, 34)
	 * $query->filterByPostcode(array('min' => 12)); // WHERE postcode > 12
	 * </code>
	 *
	 * @see       filterByCity()
	 *
	 * @param     mixed $postcode The value to use as filter.
	 *              Use scalar values for equality.
	 *              Use array values for in_array() equivalent.
	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByPostcode($postcode = null, $comparison = null)
	{
		if (is_array($postcode)) {
			$useMinMax = false;
			if (isset($postcode['min'])) {
				$this->addUsingAlias(StationPeer::POSTCODE, $postcode['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($postcode['max'])) {
				$this->addUsingAlias(StationPeer::POSTCODE, $postcode['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(StationPeer::POSTCODE, $postcode, $comparison);
	}

	/**
	 * Filter the query on the street column
	 *
	 * Example usage:
	 * <code>
	 * $query->filterByStreet('fooValue');   // WHERE street = 'fooValue'
	 * $query->filterByStreet('%fooValue%'); // WHERE street LIKE '%fooValue%'
	 * </code>
	 *
	 * @param     string $street The value to use as filter.
	 *              Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByStreet($street = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($street)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $street)) {
				$street = str_replace('*', '%', $street);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(StationPeer::STREET, $street, $comparison);
	}

	/**
	 * Filter the query by a related City object
	 *
	 * @param     City|PropelCollection $city The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByCity($city, $comparison = null)
	{
		if ($city instanceof City) {
			return $this
				->addUsingAlias(StationPeer::POSTCODE, $city->getPostcode(), $comparison);
		} elseif ($city instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(StationPeer::POSTCODE, $city->toKeyValue('PrimaryKey', 'Postcode'), $comparison);
		} else {
			throw new PropelException('filterByCity() only accepts arguments of type City or PropelCollection');
		}
	}

	/**
	 * Adds a JOIN clause to the query using the City relation
	 *
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function joinCity($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('City');

		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}

		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'City');
		}

		return $this;
	}

	/**
	 * Use the City relation City object
	 *
	 * @see       useQuery()
	 *
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    CityQuery A secondary query class using the current class as primary query
	 */
	public function useCityQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
	{
		return $this
			->joinCity($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'City', 'CityQuery');
	}

	/**
	 * Filter the query by a related Car object
	 *
	 * @param     Car $car  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByCar($car, $comparison = null)
	{
		if ($car instanceof Car) {
			return $this
				->addUsingAlias(StationPeer::STATIONID, $car->getStationid(), $comparison);
		} elseif ($car instanceof PropelCollection) {
			return $this
				->useCarQuery()
				->filterByPrimaryKeys($car->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByCar() only accepts arguments of type Car or PropelCollection');
		}
	}

	/**
	 * Adds a JOIN clause to the query using the Car relation
	 *
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function joinCar($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Car');

		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}

		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Car');
		}

		return $this;
	}

	/**
	 * Use the Car relation Car object
	 *
	 * @see       useQuery()
	 *
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    CarQuery A secondary query class using the current class as primary query
	 */
	public function useCarQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
	{
		return $this
			->joinCar($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Car', 'CarQuery');
	}

	/**
	 * Filter the query by a related Offers object
	 *
	 * @param     Offers $offers  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByOffers($offers, $comparison = null)
	{
		if ($offers instanceof Offers) {
			return $this
				->addUsingAlias(StationPeer::STATIONID, $offers->getStationid(), $comparison);
		} elseif ($offers instanceof PropelCollection) {
			return $this
				->useOffersQuery()
				->filterByPrimaryKeys($offers->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByOffers() only accepts arguments of type Offers or PropelCollection');
		}
	}

	/**
	 * Adds a JOIN clause to the query using the Offers relation
	 *
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function joinOffers($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Offers');

		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}

		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Offers');
		}

		return $this;
	}

	/**
	 * Use the Offers relation Offers object
	 *
	 * @see       useQuery()
	 *
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    OffersQuery A secondary query class using the current class as primary query
	 */
	public function useOffersQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinOffers($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Offers', 'OffersQuery');
	}

	/**
	 * Filter the query by a related Reservation object
	 *
	 * @param     Reservation $reservation  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByReservationRelatedByPickup($reservation, $comparison = null)
	{
		if ($reservation instanceof Reservation) {
			return $this
				->addUsingAlias(StationPeer::STATIONID, $reservation->getPickup(), $comparison);
		} elseif ($reservation instanceof PropelCollection) {
			return $this
				->useReservationRelatedByPickupQuery()
				->filterByPrimaryKeys($reservation->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByReservationRelatedByPickup() only accepts arguments of type Reservation or PropelCollection');
		}
	}

	/**
	 * Adds a JOIN clause to the query using the ReservationRelatedByPickup relation
	 *
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function joinReservationRelatedByPickup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('ReservationRelatedByPickup');

		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}

		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'ReservationRelatedByPickup');
		}

		return $this;
	}

	/**
	 * Use the ReservationRelatedByPickup relation Reservation object
	 *
	 * @see       useQuery()
	 *
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    ReservationQuery A secondary query class using the current class as primary query
	 */
	public function useReservationRelatedByPickupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinReservationRelatedByPickup($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'ReservationRelatedByPickup', 'ReservationQuery');
	}

	/**
	 * Filter the query by a related Reservation object
	 *
	 * @param     Reservation $reservation  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByReservationRelatedByDropoff($reservation, $comparison = null)
	{
		if ($reservation instanceof Reservation) {
			return $this
				->addUsingAlias(StationPeer::STATIONID, $reservation->getDropoff(), $comparison);
		} elseif ($reservation instanceof PropelCollection) {
			return $this
				->useReservationRelatedByDropoffQuery()
				->filterByPrimaryKeys($reservation->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByReservationRelatedByDropoff() only accepts arguments of type Reservation or PropelCollection');
		}
	}

	/**
	 * Adds a JOIN clause to the query using the ReservationRelatedByDropoff relation
	 *
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function joinReservationRelatedByDropoff($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('ReservationRelatedByDropoff');

		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}

		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'ReservationRelatedByDropoff');
		}

		return $this;
	}

	/**
	 * Use the ReservationRelatedByDropoff relation Reservation object
	 *
	 * @see       useQuery()
	 *
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    ReservationQuery A secondary query class using the current class as primary query
	 */
	public function useReservationRelatedByDropoffQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinReservationRelatedByDropoff($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'ReservationRelatedByDropoff', 'ReservationQuery');
	}

	/**
	 * Filter the query by a related Stationhours object
	 *
	 * @param     Stationhours $stationhours  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function filterByStationhours($stationhours, $comparison = null)
	{
		if ($stationhours instanceof Stationhours) {
			return $this
				->addUsingAlias(StationPeer::STATIONID, $stationhours->getStationid(), $comparison);
		} elseif ($stationhours instanceof PropelCollection) {
			return $this
				->useStationhoursQuery()
				->filterByPrimaryKeys($stationhours->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByStationhours() only accepts arguments of type Stationhours or PropelCollection');
		}
	}

	/**
	 * Adds a JOIN clause to the query using the Stationhours relation
	 *
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function joinStationhours($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Stationhours');

		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}

		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Stationhours');
		}

		return $this;
	}

	/**
	 * Use the Stationhours relation Stationhours object
	 *
	 * @see       useQuery()
	 *
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    StationhoursQuery A secondary query class using the current class as primary query
	 */
	public function useStationhoursQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinStationhours($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Stationhours', 'StationhoursQuery');
	}

	/**
	 * Exclude object from result
	 *
	 * @param     Station $station Object to remove from the list of results
	 *
	 * @return    StationQuery The current query, for fluid interface
	 */
	public function prune($station = null)
	{
		if ($station) {
			$this->addUsingAlias(StationPeer::STATIONID, $station->getStationid(), Criteria::NOT_EQUAL);
		}

		return $this;
	}

} // BaseStationQuery